package com.kainitram.library;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

public class HeaderBox extends LinearLayout {
	
	private TextView llHeader;

	public HeaderBox(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);

		inflateView();
	}
	
	public HeaderBox(Context context){
	  super(context);
	  
	  inflateView();
	}

	public HeaderBox(Context context, AttributeSet attrs){
	  super(context, attrs);
	  
	  inflateView();
	  
	  TypedArray types = context.obtainStyledAttributes(attrs, R.styleable.HeaderBoxAttributes);
	  
	  try {
		
		  String header = types.getString(R.styleable.HeaderBoxAttributes_header_box_title);
		  llHeader.setText(header);		  
	  } finally {
		types.recycle();
	  }
	}

	
	private void inflateView() {
		LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View view = inflater.inflate(R.layout.header_group,this);
		
		llHeader = (TextView)view.findViewById(R.id.lblHeader);
	}
}
